﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Runtime.Remoting.Messaging;

namespace ServerServices
{
    public class ServerServiceImpl : MarshalByRefObject, IServerService
    {
        private IDictionary<string,string> registedPeers = new Dictionary<string, string>();

        void IServerService.peerRegister(string nome, string port)
        {
            Console.WriteLine("SERVER: registedPeers called...");
            string clientIP = CallContext.GetData("ClientIPAddress").ToString();
            this.registedPeers.Add(nome,clientIP+":"+port);

        }

        IDictionary<string,string> IServerService.getPeers()
        {
            Console.WriteLine("SERVER: getPeers called...");
            return this.registedPeers;
        }
    }
}